package testing;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

public class OverviewPanel extends JPanel
{
	JTabbedPane tabPanel;
	private JMenuBar menuBar;
	private JMenu menu;
	private JMenuItem exit, dunnow;
	private Home home;
	private Handler handler;
	public TimerPanel timerPanel;
	public OrbitPanel orbitPanel;
	
	public OverviewPanel()
	{
		home = new Home(this);
		timerPanel = new TimerPanel();
		
		tabPanel = new JTabbedPane();
		tabPanel.addTab("Home", null, home, "Home");
		tabPanel.setBackground(Color.GRAY);
		tabPanel.setForeground(Color.YELLOW);
		
		menuBar = new JMenuBar();
		menu = new JMenu("Menu");
		menuBar.setBackground(Color.GRAY);
		menuBar.setBorderPainted(false);
		menuBar.add(menu);
		
		handler = new Handler();
		exit = new JMenuItem("Exit");
		exit.addActionListener(handler);
		
		menu.add(exit);
		
		setLayout(new BorderLayout());
		add(menuBar, BorderLayout.NORTH);
		add(tabPanel, BorderLayout.CENTER);
		
	}
	class Handler implements ActionListener
	{
		public void actionPerformed(ActionEvent e)
		{
			if(e.getSource() == exit)
			{
				System.exit(0);
			}
		}
	}

	public void Timer()
	{
		tabPanel.addTab("Timer", null, timerPanel, "Timer");
		tabPanel.setSelectedComponent(timerPanel);
	}

	public void Darkorbit()
	{
		tabPanel.addTab("Darkorbit", null, orbitPanel, "Darkorbit");
		tabPanel.setSelectedComponent(orbitPanel);
	}
}
